#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>

bool CheckPermutation(char* s1, char* s2)
{
    if ((s1 == NULL) && (s2 == NULL))
    {
        return false;
    }
    int l1 = strlen(s1);
    int l2 = strlen(s2);
    if (l1 != l2)
    {
        return false;
    }
    int count1[10000] = { 0 };
    int count2[10000] = { 0 };
    for (int i = 0; i < l1; i++)
    {
        count1[s1[i]]++;
    }
    for (int j = 0; j < l2; j++)
    {
        count2[s2[j]]++;
    }
    int k = 0;
    while (k < l1)
    {
        if (count1[s1[k]] != count2[s1[k]])
        {
            return false;
        }
        k++;
    }
    return true;
}

int main()
{
	char str1[] = { '\0' };
	char str2[] = { '\0' };
	scanf("%s", &str1);
	scanf("%s", &str2);
    bool s = CheckPermutation(str1, str2);
    if (s == 0)
    {
        printf("false\n");
    }
    else if(s == 1)
    {
        printf("true\n");
    }
	return 0;
}

